package com.sinosoft.common.manage.service.impl;

import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sinosoft.common.manage.domain.GoodsUnderVerdictInfo;
import com.sinosoft.common.manage.mapper.GoodsUnderVerdictInfoMapper;
import com.sinosoft.common.manage.service.GoodsUnderVerdictInfoService;
import com.sinosoft.common.manage.vo.GoodsUnderVerdictInfoVO;
import com.sinosoft.common.manage.vo.VerdictVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* @author Yeung
* @description 针对表【goods_under_verdict_info(产品核保问题结论信息表)】的数据库操作Service实现
* @createDate 2024-04-24 10:15:40
*/
@Service
@Slf4j
public class GoodsUnderVerdictInfoServiceImpl extends ServiceImpl<GoodsUnderVerdictInfoMapper, GoodsUnderVerdictInfo>
    implements GoodsUnderVerdictInfoService{

    @Resource
    private GoodsUnderVerdictInfoMapper goodsUnderVerdictInfoMapper;

    @Override
    public List<GoodsUnderVerdictInfoVO> queryByVerdict(VerdictVO verdictVO) {
        log.info("com.sinosoft.common.manage.service.impl.GoodsUnderVerdictInfoServiceImpl.queryByVerdict 入参={}", JSON.toJSONString(verdictVO));
        try {
            List<GoodsUnderVerdictInfoVO> goodsUnderVerdictInfoVOS = new ArrayList<>();
            Map<String, Object> map = new HashMap<>();
            map.put("diseaseIds",verdictVO.getDiseaseIds());
            map.put("issueIds", verdictVO.getIssueIds());
            map.put("answerIds", verdictVO.getAnswerIds());
            List<GoodsUnderVerdictInfo> goodsUnderVerdictInfoList = goodsUnderVerdictInfoMapper.queryByVerdict(map);
            for (GoodsUnderVerdictInfo goodsUnderVerdictInfo : goodsUnderVerdictInfoList) {
                GoodsUnderVerdictInfoVO goodsUnderVerdictInfoVO = new GoodsUnderVerdictInfoVO();
                BeanUtils.copyProperties(goodsUnderVerdictInfo, goodsUnderVerdictInfoVO);
                goodsUnderVerdictInfoVOS.add(goodsUnderVerdictInfoVO);
            }
            log.info("com.sinosoft.common.manage.service.impl.GoodsUnderVerdictInfoServiceImpl.queryByVerdict 返回={}", JSON.toJSONString(goodsUnderVerdictInfoVOS));
            return goodsUnderVerdictInfoVOS;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

}




